<?php
/**
 * SDOUdb 盛大统一用户模块对外接口
 * 底层接口联系人 李琛成
 * 服务地址IP=114.80.135.7    端口=1234
 * 测试 URL http://114.80.135.7:8080/doc/index.html
 * @category   SDO
 * @package    PeopleService
 * @author     ggg <wangweijun01@snda.com> 2010-3-25 17:00
 * @copyright  SDO OP
 * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
 * @link       http://www.sdo.com/
 * @since      File available since Release 1.0.0
 */

include_once(dirname(__FILE__).'/SDOSocket.php');
include_once(dirname(__FILE__).'/SDOApiHelper.php');

class SDOUdb {



 	/**
	 * 获取用户所有信息
	 * 得到一个用户的所有信息，其中包括用户的基本信息、拓展信息、统计数据、APP信息、学校信息（数组）、公司信息。
	 * @param Long $sdid  用户的数字ID
	 * @return  Array
	 * [code]
	 * Array
        (
            [entry] => Array
                (
                    [0] => Array
                        (
                            [value] => Array
                                (
                                    [appInfo] => Array
                                        (
                                            [sdid] => 597788342
                                            [appInfo1] => 13123
                                            [appInfo2] => 13123
                                        )
        
                                    [userProfileBasic] => Array
                                        (
                                            [state] => 1
                                            [level] => 1
                                            [createTime] => 0
                                            [sdid] => 597788342
                                            [nickname] => Wolfhead
                                            [sex] => 1
                                            [birthday] => 1987-07-21
                                            [blood] => 1
                                            [nationality] => 1
                                            [hometown] => 0
                                            [locality] => 0
                                            [keywords] => tags
                                            [lastModifyTime] => 1270095021000
                                            [nickLastModifyTime] => 0
                                            [avatarVersion] => 1
                                            [searchFlag] => 1
                                            [activeFlag] => 0
                                            [memberType] => 1
                                            [registerTime] => 0
                                            [registerIp] => 0.0.0.0
                                        )
        
                                    [userProfileCompany] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [id] => 27
                                                    [position] => 额滴神啊
                                                    [createTime] => 1270089950000
                                                    [sdid] => 597788342
                                                    [lastModifyTime] => 1270089950000
                                                    [company] => 神啊
                                                    [startDate] => 1900-03-03
                                                    [endDate] => 2012-03-03
                                                )
                                        )
        
                                    [userProfileEducation] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [id] => 28
                                                    [createTime] => 1270089950000
                                                    [sdid] => 597788342
                                                    [lastModifyTime] => 1270089950000
                                                    [schoolName] => 哈佛
                                                    [schoolType] => 1
                                                    [major] => 佛教
                                                    [classroom] => 1
                                                    [startYear] => 0
                                                )
                                        )
        
                                    [userProfileExtend] => Array
                                        (
                                            [sdid] => 597788342
                                            [hobby] => eat
                                            [qq] => 597788343
                                            [msn] => whatever@whatever.com
                                            [mail] => whatever@whatever.com
                                            [mobile] => 123123123
                                            [tel] => 123123123
                                            [idol] => 食神
                                            [recentVision] => 成为食神
                                            [motto] => 牙好，嘿，胃口就好
                                            [favoriteMovieTv] => 好电影
                                            [favoriteBook] => 好书
                                            [favoriteMusic] => 好音乐
                                            [favoriteSport] => 好运动
                                            [webStation] => www.www.com
                                        )
        
                                    [userProfileStatistic] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [id] => 21
                                                    [sdid] => 597788342
                                                    [title] => 1
                                                    [titleCount] => 1
                                                )
        
                                            [1] => Array
                                                (
                                                    [id] => 22
                                                    [sdid] => 597788342
                                                    [title] => 2
                                                    [titleCount] => 2
                                                )
        
                                        )
        
                                )
        
                        )
        
                )
        
            [itemsPerPage] => 1
            [startIndex] => 0
            [totalResults] => 1
        )
	 * [/code]
	 * @example
	 * [code]  
	      $result = SDOUdb::getPeople($this->uid);
	 * [/code]
	 */
	static public function getPeople($uid)
	{
		
		$api_name	= 'PeopleService.getPeople';
		
		
		$api_param	= array(
			'sdid' => $uid
		);		
		return self::send($api_name,$api_param);
	}


 	/**
	 * 获取用户基础信息
	 * 得到一个用户的基础信息，主要包含每次必须被读取出的基本信息。
	 * @param Long $uid  用户的数字ID
	 * @return  Array
	 * [code]
            Array
            (
                [entry] => Array
                    (
                        [0] => Array
                            (
                                [value] => Array
                                    (
                                        [state] => 1
                                        [level] => 1
                                        [createTime] => 0
                                        [sdid] => 597788342
                                        [nickname] => Wolfhead
                                        [sex] => 1
                                        [birthday] => 1987-07-21
                                        [blood] => 1
                                        [nationality] => 1
                                        [hometown] => 0
                                        [locality] => 0
                                        [keywords] => tags
                                        [lastModifyTime] => 1270095021000
                                        [nickLastModifyTime] => 0
                                        [avatarVersion] => 1
                                        [searchFlag] => 1
                                        [activeFlag] => 0
                                        [memberType] => 1
                                        [registerTime] => 0
                                        [registerIp] => 0.0.0.0
                                    )
            
                            )
            
                    )
            
                [itemsPerPage] => 1
                [startIndex] => 0
                [totalResults] => 1
            )
	 * [/code]
	 * @example
	 * [code]
	 *     $result = SDOUdb::getBasicInfo($this->uid);
	 * [/code]
	 */
	static public function getBasicInfo($uid)
	{
		
		$api_name	= 'PeopleService.getBasicInfo';
		
		
		$api_param	= array(
			'sdid' => $uid
		);		
		return self::send($api_name,$api_param);
	}


 	/**
	 * 获取用户拓展信息
	 * 得到一个用户的拓展信息，主要包含联系方式和用户的爱好。
	 * @param Long $uid  用户的数字ID
	 * @return  Array
	 * [code]
	 * Array
        (
            [entry] => Array
                (
                    [0] => Array
                        (
                            [value] => Array
                                (
                                    [sdid] => 597788342
                                    [hobby] => eat
                                    [qq] => 597788343
                                    [msn] => whatever@whatever.com
                                    [mail] => whatever@whatever.com
                                    [mobile] => 123123123
                                    [tel] => 123123123
                                    [idol] => 食神
                                    [recentVision] => 成为食神
                                    [motto] => 牙好，嘿，胃口就好
                                    [favoriteMovieTv] => 好电影
                                    [favoriteBook] => 好书
                                    [favoriteMusic] => 好音乐
                                    [favoriteSport] => 好运动
                                    [webStation] => www.www.com
                                )
        
                        )
        
                )
        
            [itemsPerPage] => 1
            [startIndex] => 0
            [totalResults] => 1
        )
	 * [/code]
	 * @example
	 * [code]
	 * $result = SDOUdb::getExtendInfo($this->uid);
	 * [/code]
	 */
	static public function getExtendInfo($uid)
	{
		
		$api_name	= 'PeopleService.getExtendInfo';
		
		
		$api_param	= array(
			'sdid' => $uid
		);		
		return self::send($api_name,$api_param);
	}


 	/**
	 * 获取用户APP 信息
	 * 得到一个用户的应用信息，具体存放内容和作用未定。
	 * @param Long $uid  用户的数字ID
	 * @return  Array
     * [code]
        Array
        (
            [entry] => Array
                (
                    [0] => Array
                        (
                            [value] => Array
                                (
                                    [sdid] => 597788342
                                    [appInfo1] => 13123
                                    [appInfo2] => 13123
                                )
        
                        )
        
                )
        
            [itemsPerPage] => 1
            [startIndex] => 0
            [totalResults] => 1
        )
     * [/code]
     * @example
     * [code]
     * $result = SDOUdb::getAppInfo($this->uid);
     * [/code]
	 */
	static public function getAppInfo($uid)
	{
		
		$api_name	= 'PeopleService.getAppInfo';
		
		
		$api_param	= array(
			'sdid' => $uid
		);		
		return self::send($api_name,$api_param);
	}


 	/**
	 * 获取用户统计信息
	 * 得到一个用户的统计信息，主要关于用户的留言条数，回复条数相关信息，返回的是一个list形式
	 * @param Long $uid  用户的数字ID
     * @return  Array
     * [code]
        Array
        (
            [entry] => Array
                (
                    [0] => Array
                        (
                            [value] => Array
                                (
                                    [id] => 21
                                    [sdid] => 597788342
                                    [title] => 1
                                    [titleCount] => 1
                                )
        
                        )
        
                    [1] => Array
                        (
                            [value] => Array
                                (
                                    [id] => 22
                                    [sdid] => 597788342
                                    [title] => 2
                                    [titleCount] => 2
                                )
        
                        )
        
                )
        
            [itemsPerPage] => 2
            [startIndex] => 0
            [totalResults] => 2
        )
     * [/code]
     * @example
     * [code]
     * $result = SDOUdb::getStatistic($this->uid);
     * [/code]
	 */
	static public function getStatistic($uid)
	{
		
		$api_name	= 'PeopleService.getStatistic';
		
		$api_param	= array(
			'sdid' => $uid
		);		
		return self::send($api_name,$api_param);
	}

 	/**
	 * 获取用户教育信息
	 * 得到一个用户的教育信息，主要是教育经历：学校、专业、班级等
	 * @param Long $uid  用户的数字ID
     * @return  Array
     * [code]
        Array
        (
            [entry] => Array
                (
                    [0] => Array
                        (
                            [value] => Array
                                (
                                    [id] => 28
                                    [createTime] => 1270089950000
                                    [sdid] => 597788342
                                    [lastModifyTime] => 1270089950000
                                    [schoolName] => 哈佛
                                    [schoolType] => 1
                                    [major] => 佛教
                                    [classroom] => 1
                                    [startYear] => 0
                                )
        
                        )
        
                    [1] => Array
                        (
                            [value] => Array
                                (
                                    [id] => 29
                                    [createTime] => 1270094682000
                                    [sdid] => 597788342
                                    [lastModifyTime] => 1270094682000
                                    [schoolName] => 哈佛
                                    [schoolType] => 1
                                    [major] => 佛教
                                    [classroom] => 1
                                    [startYear] => 0
                                )
        
                        )
                )
        
            [itemsPerPage] => 2
            [startIndex] => 0
            [totalResults] => 2
        )
     * [/code]
     * @example
     * [code]
     * $result = SDOUdb::getEducations($this->uid);
     * [/code]
	 */
	static public function getEducations($uid)
	{
		
		$api_name	= 'PeopleService.getEducations';
		
		$api_param	= array(
			'sdid' => $uid
		);		
		return self::send($api_name,$api_param);
	}

 	/**
	 * 获取用户公司信息
	 * 得到一个用户的公司信息，主要是工作经历、公司、职位等等。
	 * @param Long $uid  用户的数字ID
     * @return  Array
     * [code]
            Array
            (
                [entry] => Array
                    (
                        [0] => Array
                            (
                                [value] => Array
                                    (
                                        [id] => 27
                                        [position] => 额滴神啊
                                        [createTime] => 1270089950000
                                        [sdid] => 597788342
                                        [lastModifyTime] => 1270089950000
                                        [company] => 神啊
                                        [startDate] => 1900-03-03
                                        [endDate] => 2012-03-03
                                    )
            
                            )
            
                        [1] => Array
                            (
                                [value] => Array
                                    (
                                        [id] => 28
                                        [position] => 额滴神啊
                                        [createTime] => 1270094682000
                                        [sdid] => 597788342
                                        [lastModifyTime] => 1270094682000
                                        [company] => 神啊
                                        [startDate] => 1900-03-03
                                        [endDate] => 2012-03-03
                                    )
            
                            )
            
            
                    )
            
                [itemsPerPage] => 2
                [startIndex] => 0
                [totalResults] => 2
            )
     * [/code]
     * @example
     * [code]
     * $result = SDOUdb::getCompanys($this->uid);
     * [/code]
	 */
	static public function getCompanys($uid)
	{
		
		$api_name	= 'PeopleService.getCompanys';
		
		$api_param	= array(
			'sdid' => $uid
		);		
		return self::send($api_name,$api_param);
	}


 	/**
	 * 新增用户
	 * 通过添加用户的Basic信息增加一个用户。
	 * @param Long		$uid	            	用户的数字ID
	 * @param Array		$paramArray	            	参数内容, key=> value形式, ,可传key及含义如下
     *      String     $nickname        用户昵称             
     *      Integer    $avatorver       用户头像版本             
     *      Integer    $sex                    用户性别             
     *      String     $birthday        用户生日             
     *      Integer    $boold           用户血型
     *      Integer    $nationality     用户国籍             
     *      String     $hometown        用户家乡             
     *      String     $locality        用户所在地             
     *      Integer    $searchflag      搜索标志，表示是否能被搜索到             
     *      String     $keywords        用户关键字             
     *      Integer    $state           用户状态             
     *      Integer    $membertype      用户会员类型            
    /**
     * 获取用户公司信息
     * 得到一个用户的公司信息，主要是工作经历、公司、职位等等。
     * @param Long $uid  用户的数字ID
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111160
                [affectedItems] => 1
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
         $result = SDOUdb::addPeople($this->uid, array(
            'nickname' => $this->nickname,
            'avatorver' => $this->avatorver,
            'sex'       => $this->sex,
            'birthday'  => $this->birthday,
            'blood'     => $this->blood,
            'nationality'   => $this->nationality,
            'hometown'      => $this->hometown,
            'locality'      => $this->locality,
            'searchflag'    => $this->searchflag,
            'keywords'      => $this->keywords,
            'state'         => $this->state,
            'membertype'    => $this->membertype
            ));
     * [/code]
	 */
	static public function addPeople($uid,$paramArray=array())
	{
		
		//允许传的参数
		$allow_param	= array('nickname','avatorver','sex','birthday','blood','nationality','hometown','locality','searchflag','keywords','state','membertype');

		$api_param	= SDOApiHelper::getAllowArray($allow_param,$paramArray);
		$api_param['sdid']	= $uid;

		$api_name	= 'PeopleService.addPeople';

		return self::send($api_name,$api_param);
	}


	

 	/**
	 * 新增用户学校信息
	 * 添加一个用户的学校信息，内容是用户的一段教育经历。
	 * @param Long  $uid                        用户的数字ID  
	 * @param String   
	 * @param Array		$paramArray	            	参数内容, key=> value形式, ,可传key及含义如下
	 *		String		$name              	学校名称  
	 *		Integer       $type               	学校类型  
	 *		String        $major              	专业名称  
	 *		String        $classno            	班级       
	 *		Integer        $startyear       	入学年份  
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111190
                [affectedItems] => 1
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
        $result = SDOUdb::addEducation($this->uid, "哈佛", 1, array(
            'major'     => "佛教",
            'classno'   => "1",
            'startyear' => "1900-1-1"
        ));
     * [/code]
	 */
	static public function addEducation($uid,$name,$type,$paramArray=array())
	{

		$allow_param	= array('major','classno','startyear');

		$api_param	= SDOApiHelper::getAllowArray($allow_param,$paramArray);
		$api_param['sdid']	   = $uid;
		$api_param['name']    = $name;
		$api_param['type']    = $type;

		$api_name	= 'PeopleService.addEducation';


		return self::send($api_name,$api_param);
	}


 	/**
	 * 新增用户公司信息
	 * 添加用户的公司信息，主要内容为一段工作经历
	 * @param Long		$uid       	用户的数字ID             
	 * @param Array		$paramArray	            	参数内容, key=> value形式, ,可传key及含义如下
	 *	 	$name       	公司名称             
	 * 		$position       	公司职位             
	 * 		$startdate       	开始日期             
	 * 		$enddate       	结束日期             
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111210
                [affectedItems] => 0
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
        $result = SDOUdb::addCompany($this->uid,array(
            'name' => "神啊",
            'position' => "额滴神啊",
            'startdate' => "1900-3-3",
            'enddate' => "2012-3-3"
        ));
     * [/code]
	 */
	static public function addCompany($uid,$paramArray=array())
	{
		//允许传的参数
		$allow_param	= array('name','position','startdate','enddate');

		$api_param	= SDOApiHelper::getAllowArray($allow_param,$paramArray);
		$api_param['sdid']	= $uid;


		$api_name	= 'PeopleService.addCompany';
		
		return self::send($api_name,$api_param);
	}
	
   /**
     * 新增用户公司信息
     * 添加用户的公司信息，主要内容为一段工作经历
     * @param Long      $uid        用户的数字ID             
     * @param Array     $staticsticInfo    统计数据的key=>value Pair数组
     *                  Integer key 统计名
     *                  Integer value 统计数值
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111210
                [affectedItems] => 0
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
        $result = SDOUdb::addStatistic($this->uid,array(
            1 => 1,
            2 => 2
        ));
     * [/code]
     */
    static public function addStatistic($uid,$staticsticInfo=array())
    {
        //允许传的参数

        $api_param['sdid']  = $uid;
        if (!empty($staticsticInfo))
        {
            $api_param['title'] = implode(",", array_keys($staticsticInfo));
            $api_param['count'] = implode(",", array_values($staticsticInfo));
        }

        $api_name   = 'PeopleService.addStatistic';
        
        return self::send($api_name,$api_param);
    }
	
 	/**
	 * 更新用户基本信息
	 * 更新用户的基本信息，包括昵称、头像版本、性别等等。
	 * @param Long		$uid       	用户的数字ID             
	 * @param Array		$paramArray	            	参数内容, key=> value形式, ,可传key及含义如下
	 *		String     $nickname       	用户昵称             
	 * 		Integer    $avatorver       用户头像版本             
	 * 		Integer    $sex       	           用户性别             
	 *		String     $birthday       	用户生日             
	 *      Integer    $boold           用户血型
	 * 		Integer    $nationality     用户国籍             
	 *		String     $hometown       	用户家乡             
	 *		String     $locality       	用户所在地             
	 * 		Integer    $searchflag      搜索标志，表示是否能被搜索到             
	 *		String     $keywords       	用户关键字             
	 * 		Integer    $state       	用户状态             
	 *      Integer    $level           用户等级
	 * 		Integer    $membertype      用户会员类型             
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111240
                [affectedItems] => 1
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
        $result = SDOUdb::updateBasicInfo($this->uid,array(
            'nickname' => $this->nickname,
            'avatorver' => $this->avatorver,
            'sex'       => $this->sex,
            'birthday'  => $this->birthday,
            'blood'     => $this->blood,
            'nationality'   => $this->nationality,
            'hometown'      => $this->hometown,
            'locality'      => $this->locality,
            'searchflag'    => $this->searchflag,
            'keywords'      => $this->keywords,
            'state'         => $this->state,
            'membertype'    => $this->membertype,
            'level'         => 1
        ));
     * [/code]
	 */
	static public function updateBasicInfo($uid,$paramArray=array())
	{
		//允许传的参数
		$allow_param	= array('nickname','avatorver','sex','birthday','blood',
		              'nationality','hometown','locality','searchflag','keywords',
		              'state','level','membertype');

		$api_param	= SDOApiHelper::getAllowArray($allow_param,$paramArray);
		$api_param['sdid']	= $uid;


		$api_name	= 'PeopleService.updateBasicInfo';
		
		return self::send($api_name,$api_param);

	}


 	/**
	 * 更新用户拓展信息
	 * 更新用户的拓展信息，包括联系信息、爱好信息等等。
	 * @param Long     $uid        用户的数字ID
	 * @param Array		$paramArray	参数内容, key=> value形式, ,可传key及含义如下         
	 *	 	Long      $qq       	QQ             
	 *	 	String    $msn       	MSN             
	 *	 	String    $mail       	电子邮箱地址             
	 *	 	String    $mobile       手机号码             
	 *	 	String    $tel       	座机号码             
	 *	 	String    $website       个人网站             
	 *	 	String    $hobby       	兴趣爱好             
	 *	 	String    $idol       	偶像             
	 *	 	String    $recentvi     最近的理想             
	 *	 	String    $motto       	座右铭             
	 *	 	String    $favormovie       	喜欢的影视             
	 *	 	String    $favorbook       	喜欢的书籍             
	 *	 	String    $favormusic       	喜欢的音乐             
	 *	 	String    $favorsport       	喜欢的运动             
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111240
                [affectedItems] => 1
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
        $result = SDOUdb::updateExtendInfo($this->uid,array(
            'qq'        => 597788343,
            'msn'       => "whatever@whatever.com",
            'mail'      => "whatever@whatever.com",
            'mobile'    => "123123123",
            'tel'       => "123123123",
            'website'   => "www.www.com",
            'hobby'     => "eat",
            'idol'      => "食神",
            'recentvi'  => "成为食神",
            'motto'     => "牙好，嘿，胃口就好",
            'favormovie'=> "好电影",
            'favorbook' => "好书",
            'favormusic'=> "好音乐",
            'favorsport'=> "好运动"
        ));
     * [/code]
	 */
	static public function updateExtendInfo($uid,$paramArray=array())
	{

		$allow_param	= array('qq','msn','mail','mobile','tel','website','hobby','idol','recentvi','motto','favormovie','favorbook','favormusic','favorsport');

		$api_param	= SDOApiHelper::getAllowArray($allow_param,$paramArray);
		$api_param['sdid']	= $uid;


		$api_name	= 'PeopleService.updateExtendInfo';
		

		return self::send($api_name,$api_param);

	}


 	/**
	 * 更新用户APP 信息
	 * 修改用户的App信息，目前作用未定。
	 * @param Long		$uid       	用户的数字ID     
	 * @param Array     $paramArray 参数内容, key=> value形式, ,可传key及含义如下            
	 *         String		$app1       	用户APP信息1             
	 *         String		$app2       	用户APP信息2            
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111240
                [affectedItems] => 1
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
        $result = SDOUdb::updateAppInfo($this->uid,array(
            'app1' => "13123",
            'app2' => "13123"
        ));
     * [/code]
	 */
	static public function updateAppInfo($uid, $paramArray=array())
	{
		$api_name	= 'PeopleService.updateAppInfo';
		
		$allow_param    = array('app1','app2');

        $api_param  = SDOApiHelper::getAllowArray($allow_param,$paramArray);
		
        $api_param['sdid'] = $uid;
        	
		return self::send($api_name,$api_param);

	}


 	/**
	 * 更新用户教育信息
	 * 更新一个用户的教育信息，内容为一段教育经历。
	 * @param Long		$uid       	   用户的数字ID        
	 * @param Long      $educationId 教育记录ID          
	 * @param Array		$paramArray	            	参数内容, key=> value形式, ,可传key及含义如下            
	 *		$name           学校名称             
	 *		$type       	学校类型             
	 *		$major       	专业名称             
	 *		$classno       	班级             
	 *		$startyear       	入学年份                
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111240
                [affectedItems] => 1
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
        $result = SDOUdb::updateEducation($this->uid,1,array(
            'name'      => "大佛",
            'type'      => 1,
            'major'     => "佛教",
            'classno'   => "1",
            'startyear' => "1900-0-0"
        ));
     * [/code]
	 */
	static public function updateEducation($uid,$educationId,$paramArray=array())
	{

		//允许传的参数
		$allow_param	= array('name','type','major','classno','startyear');

		$api_param	= SDOApiHelper::getAllowArray($allow_param,$paramArray);
		$api_param['sdid']	= $uid;
		$api_param['id']    = $educationId;


		$api_name	= 'PeopleService.updateEducation';
		
		return self::send($api_name,$api_param);

	}


 	/**
	 * 更新用户公司信息
	 * 得到一个用户的所有信息，其中包括用户的基本信息、拓展信息、统计数据、APP信息、学校信息（数组）、公司信息。
	 * @param Long      $uid           用户的数字ID        
     * @param Long      $companyId    公司记录ID   
	 * @param Array		$paramArray	            	参数内容, key=> value形式, ,可传key及含义如下   
	 *		 String		$name       	公司名称             
	 *		 String		$position       	公司职位             
	 *		 String		$startdate       	开始日期             
	 *		 String		$enddate       	结束日期             
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111240
                [affectedItems] => 1
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
        $result = SDOUdb::updateCompany($this->uid,1,array(
            'name' => "神啊",
            'position' => "额滴神啊",
            'startdate' => "1900-3-3",
            'enddate' => "2012-3-3"
        ));
     * [/code]
	 */
	static public function updateCompany($uid, $companyId, $paramArray=array())
	{
		//允许传的参数
		$allow_param	= array('name','position','startdate','enddate');

		$api_param	= SDOApiHelper::getAllowArray($allow_param,$paramArray);
		$api_param['sdid']	= $uid;
		$api_param['id']    = $companyId;


		$api_name	= 'PeopleService.updateCompany';
		
		return self::send($api_name,$api_param);

	}
	
   /**
     * 更新统计信息
     * 修改用户的统计信息，修改一个统计计数。更新几个就会返回几个affecteditems
     * @param Long      $uid           用户的数字ID        
     * @param Array     $staticsticInfo    统计数据的key=>value Pair数组
     *                  Integer key 统计名
     *                  Integer value 统计数值          
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111240
                [affectedItems] => 1
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
        $result = SDOUdb::updateStatistic($this->uid,array(
            1 => 1,
            2 => 2
        ));
     * [/code]
     */
    static public function updateStatistic($uid, $staticsticInfo=array())
    {

        $api_param = array();
        $api_param['sdid']  = $uid;
        if (!empty($staticsticInfo))
        {
            $api_param['title'] = implode(",", array_keys($staticsticInfo));
            $api_param['count'] = implode(",", array_values($staticsticInfo));
        }

        $api_name   = 'PeopleService.updateStatistic';
        
        return self::send($api_name,$api_param);

    }


 	/**
	 * 删除用户（不删除数据，仅仅置删除位）
	 * 将一个用户从系统中删除，仅仅置删除位，并不会删除数据。
	 * @param Long		$uid       	用户的数字ID             
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111240
                [affectedItems] => 1
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
            $result = SDOUdb::deletePeople($this->uid);
     * [/code]
	 */
	static public function deletePeople($uid)
	{
		$api_name	= 'PeopleService.deletePeople';
		
		$api_param	= array(
			'sdid' =>          $uid     
		);		
		return self::send($api_name,$api_param);

	}


 	/**
	 * 删除用户教育信息
	 * 删除用户的教育信息，不会删除数据，仅仅修改删除位。
	 * @param Long		$uid       	用户的数字ID             
	 * @param Long		$educationId       	该记录的ID             
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111240
                [affectedItems] => 1
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
            $result = SDOUdb::deleteEducation($this->uid);
     * [/code]
	 */
	static public function deleteEducation($uid,$educationId)
	{
		$api_name	= 'PeopleService.deleteEducation';
		
		$api_param	= array(
			'sdid' =>          $uid     
			,'id' =>          $educationId     
		);		
		return self::send($api_name,$api_param);

	}

 	/**
	 * 删除用户公司信息
	 * 删除用户的公司，不会删除数据，仅仅修改删除位。
	 * @param Long		$uid       	用户的数字ID             
	 * @param Long		$companyId       	该记录的ID             
     * @return  Array
     * [code]
            Array
            (
                [updateTime] => 1270098111240
                [affectedItems] => 1
                [success] => 1
            )
     * [/code]
     * @example
     * [code]
     *         
            $result = SDOUdb::deleteCompany($this->uid);
     * [/code]
	 */
	static public function deleteCompany($uid,$companyId)
	{
		$api_name	= 'PeopleService.deleteCompany';
		
		$api_param	= array(
			'sdid' =>          $uid     
			,'id' =>          $companyId     
		);		
		return self::send($api_name,$api_param);

	}

   /**
     * 向服务器端发起请求
     * @param String $apiName API名称
     * @param Array $apiParam API相关参数
     * 返回调用的结果
     *
     */
    static public function send($apiName,$apiParam)
    {
        //$result   = SDOSocket::httpRequest($apiName,$apiParam);
        $result = SDOSocket::send($apiName,$apiParam);
        return $result;
    }
    
   /*
     * 检查返回是否正常
     * @param $result 调用send后的结果
     * @param $Error 返回错误码与信息
     * @return boolean
     */
    static function isError(&$result, &$Error = NULL)
    {
        return SDOSocket::isError($result,$Error);
    }
}